<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core">
  <body>
    <ui:composition template="/WEB-INF/templates/docente.xhtml">
      <ui:define name="titoloSottoSezione">
        Richieste Effettuate
      </ui:define>
      
      <ui:define name="contenuto">
        <h3>Richieste Effettuate:</h3>
        
        <ui:fragment rendered="#{mainBean.docente.richiesteBean.numeroRichieste > 0}">
          <table border="1" cellspacing="0" cellpadding="2" style="border-style: solid; border-color: #000000">
            <thead class="tableHeader">
              <tr>
                <th style="border-style: solid; border-color: #000000">Insegnamento</th>
                <th style="border-style: solid; border-color: #000000">SSD</th>
                <th style="border-style: solid; border-color: #000000">CFU</th>
                <th style="border-style: solid; border-color: #000000">Corso di laurea</th>
                <th style="border-style: solid; border-color: #000000">Posizione pubblicata nel bando del</th>
                <th style="border-style: solid; border-color: #000000">Richiesta effettuata il</th>
                <th style="border-style: solid; border-color: #000000"></th>
              </tr>
            </thead>
            <tbody>
              <ui:repeat value="#{mainBean.docente.richiesteBean.richieste}" var="richiestaBean" varStatus="info">
                <tr class="#{info.even ? 'tableRow1' : 'tableRow2'}">
                  <td style="border-style: solid">#{richiestaBean.insegnamento.nome}</td>
                  <td style="border-style: solid">#{richiestaBean.insegnamento.ssd}</td>
                  <td style="border-style: solid">#{richiestaBean.insegnamento.cfu}</td>
                  <td style="border-style: solid">#{richiestaBean.insegnamento.corso}</td>
                  <td style="border-style: solid">#{richiestaBean.dataPubblicazioneBando}</td>
                  <td style="border-style: solid">#{richiestaBean.dataRichiesta}</td>
                  <td style="border-style: solid">
                    <h:form>
                      <h:commandLink rendered="#{richiestaBean.attiva}" value="Cancella la richiesta per questo insegnamento" action="#{richiestaBean.cancellaRichiesta}"/>
                    </h:form>
                  </td>
                </tr>
              </ui:repeat>
            </tbody>
          </table>
        </ui:fragment>
        
        <h3>
          <h:outputText rendered="#{mainBean.docente.richiesteBean.numeroRichieste == 0}"
            value="Nessuna richiesta effettuata"/>
        </h3>
      </ui:define>
    </ui:composition>
  </body>
</html>